<?php

$api->version('v1', ['middleware' => 'api', 'prefix' => 'api', 'namespace' => 'App\Api\V1\Controllers'], function ($api) {

    $api->any('hello', function () {
        //return getallheaders();

        return response()->json([
            'message' => 'hello world',
        ]);
    });

    $api->post('getCode', 'AuthorizationController@getCode');//获取验证码
    $api->post('login', 'AuthorizationController@login');//登录
    //$api->post('refreshToken', 'AuthorizationController@refreshToken')->middleware('jwt.refresh');//刷新token
    $api->post('refreshToken', 'AuthorizationController@refreshToken');//刷新token


    //$api->getCurrentRequest()->set('token', 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG92ZXN1cGVybWFya2V0LmtlamkxMTAuY2MvYXBpL2xvZ2luIiwiaWF0IjoxNTUyOTgwNTY0LCJleHAiOjE1NTM1ODUzNjQsIm5iZiI6MTU1Mjk4MDU2NCwianRpIjoidkQ3QWw0d3VYb2pnS05xeiIsInN1YiI6MTcsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ.zdUKDMmDVOvAyKnNUAaF5hVN1vzwn7QvbPsMrHc4AmM');

    $api->group(['middleware' => 'jwt.auth'], function ($api) {

        $api->post('user', 'AuthorizationController@user');//获取用户信息
        $api->post('logout', 'AuthorizationController@logout');//退出登录

        $api->post('getUserById', 'UserController@getUserById');//根据id获取用户信息
        $api->post('getUserByQrCode', 'UserController@getUserByQrCode');//根据二维码获取用户信息
        $api->post('getUsers', 'UserController@getUsers');//获取用户列表
        $api->post('editUser', 'UserController@editUser');//修改用户信息
        $api->post('sendCode', 'UserController@sendCode');//修改手机号--验证手机/获取验证码
        $api->post('validateCode', 'UserController@validateCode');//修改手机号--验证验证码
        $api->post('addUser', 'UserController@addUser');//添加户主
        $api->post('removeUser', 'UserController@removeUser');//删除用户

        $api->post('getBehaviorCat', 'BehaviorController@getBehaviorCat');//获取行为分类
        $api->post('getBehaviors', 'BehaviorController@getBehaviors');//获取全部行为
        $api->post('getBehaviorByCat', 'BehaviorController@getBehaviorByCat');//根据行为分类获取行为
        $api->post('addBehaviorRecord', 'BehaviorController@addBehaviorRecord');//记录打分
        $api->post('getBehaviorRecords', 'BehaviorController@getBehaviorRecords');//获取记录
        $api->post('getNewBehaviorRecords', 'BehaviorController@getNewBehaviorRecords');//获取最新10条记录
        $api->post('getBehaviorRange', 'BehaviorController@getBehaviorRange');//获取排行榜
        //$api->post('getMyBehaviorRecords', 'BehaviorController@getMyBehaviorRecords');//获取我的点评
        //$api->post('getAllBehaviorRecords', 'BehaviorController@getAllBehaviorRecords');//获取全部点评
        $api->post('getRecords', 'BehaviorController@getRecords');//获取全部点评
        $api->post('getRecordsByUserId', 'BehaviorController@getRecordsByUserId');//根据用户id获取点评记录
        $api->post('getBehaviorImages', 'BehaviorController@getBehaviorImages');//获取行为图标
        $api->post('addBehavior', 'BehaviorController@addBehavior');//添加行为
        $api->post('removeBehavior', 'BehaviorController@removeBehavior');//删除行为
        $api->post('editBehavior', 'BehaviorController@editBehavior');//修改行为

        $api->post('addFeedback', 'FeedbackController@addFeedback');//添加反馈






    });





});
